#pragma once
#include "base/core/singleton.h"
#include "base/core/script.h"
#include "base/core/buffer_pool.h"

class ScriptMgrCS : public ManualSingleton<ScriptMgrCS>
{
	friend class ManualSingleton<ScriptMgrCS>;

protected:
	LuaScript  m_script;
	BufferPool m_memoryPool;

public:
    bool Init();
    bool UnInit();
    bool Update(uint64_t tick);

    bool  ResetScriptState(bool reload);
    bool  ReloadScriptFile(const char* fileName);
    bool  ReLoadScript();
    LuaScript* GetScript();

protected:
    bool _LoadBootScript();
    bool _RegistScriptObject();

	ScriptMgrCS();
	virtual ~ScriptMgrCS();
};

#define  g_MakeCSScriptMgr() (ScriptMgrCS::Instance())
#define  g_GetCSScriptMgr()  (ScriptMgrCS::GetInstance())
#define  g_DelCSScriptMgr()  (ScriptMgrCS::Destroy())
